package org.vectrics.device;

/**
 * Title:        Messaging Extension (JMX)
 * Description:  Provide generic queued messaging services leveraging J2EE JMX and \nJava Servlets(JSP) for Data retrieval to clients.
 * Copyright:    Copyright (c) 2001
 * @author Unknown
 * @version 1.0
 */



public class DeviceModel {

    public static String MAKER_DEFAULT = null;
    public static String MAKER_RIM = "RIM";
    public static String MAKER_HP = "HP";
    public static String MAKER_IBM = "IBM";
    public static String MAKER_COMPAQ = "Compaq";

    public static String DT_DEFAULT = null;
    public static String DT_850 = "850";
    public static String DT_857 = "857";
    public static String DT_950 = "950";
    public static String DT_957 = "957";
    public static String DT_IPAQ = "iPaq";

    public static String HW_VERSION_DEFAULT = null;

    public static String SW_TYPE_DEFAULT = null;

    public static String SW_VERSION_DEFAULT = null;

    public static DeviceModel RIM857_DEVICE = new DeviceModel(MAKER_RIM, DT_857);
    public static DeviceModel RIM957_DEVICE = new DeviceModel(MAKER_RIM, DT_957);

    String maker = MAKER_DEFAULT;
    String deviceType = DT_DEFAULT;
    String hardwareVersion = HW_VERSION_DEFAULT;
    String softwareType = SW_TYPE_DEFAULT;
    String softwareVersion = SW_VERSION_DEFAULT;


    public DeviceModel(String iMaker, String iType, String iVersion) {
        this.deviceType =iType;
        this.maker = iMaker;
        this.hardwareVersion = iVersion;
        this.softwareType = SW_TYPE_DEFAULT;
        this.softwareVersion = SW_VERSION_DEFAULT;
    }


    public DeviceModel(String iMaker, String iType) {
        this.deviceType =iType;
        this.maker = iMaker;
        this.hardwareVersion = HW_VERSION_DEFAULT;
        this.softwareType = SW_TYPE_DEFAULT;
        this.softwareVersion = SW_VERSION_DEFAULT;
    }


    public String getDeviceType() {
        return(deviceType);
    }


    public void setDeviceType(String deviceType) {
        this.deviceType = new String(deviceType);
    }

    public String toString()
    {
        StringBuffer result = new StringBuffer();
        result.append(maker + " ");
        result.append(deviceType + " ");
        if (hardwareVersion != null)
            result.append(hardwareVersion + " ");
        if (softwareType == null) {
            if (softwareVersion != null) {
                result.append(" OS Version: " + softwareVersion + " ");
            }
        }
        else {
            result.append(" OS: " + softwareType + " ");
            if (softwareVersion != null) {
                result.append(" v. " + softwareVersion + " ");
            }
        }
        return(result.toString().trim());
    };


}